import type { LoginResponseData } from "@/types/login"
import { defineStore } from "pinia"
import { ref } from "vue"

export const useUserStore = defineStore('GEEKPARK_USER', () => {
  // 用户信息-token
  const userInfo = ref<LoginResponseData>()

  // 设置用户信息-token
  const setUserInfo = (data: LoginResponseData) => {
    userInfo.value = data
  }

  // 清楚userInfo
  const clearUserInfo = () => {
    userInfo.value = undefined
  }

  return {
    userInfo,
    setUserInfo,
    clearUserInfo
  }
},
{
  persist: true
})